package student.aistar.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import student.aistar.model.entity.Collect;
import student.aistar.model.entity.Product;

import java.util.List;

/**
 * @Description:推荐
 * @Auther: zhugefeng
 * @Date:2021/10/24 15:24
 **/
public interface ItemCFMapper {
    @Select("select * from collect")
    List<Collect> findAllCollects();

    @Select("select * from collect where user_id=#{userId} and product_id = #{productId}")
    Collect findByUserIdAndProductId(@Param("userId") Integer userId, @Param("productId") Integer productId);

    @Select("select count(collect_id) from collect")
    Integer findCollectCount();

    @Select("select * from collect where user_id=#{userId}")
    List<Collect> findCollectByUser(Integer userId);

    @Select("select * from product where product_id=#{productId}")
    Product findByProductId(Integer productId);
}
